<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
        <p id="p1">这是一段文本。</p>
        <input type="button" value="隐藏文本" onclick="document.getElementById('p1').style.visibility = 'hidden'" />
        <input type="button" value="显示文本" onclick="document.getElementById('p1').style.visibility = 'visible'" />
    </body>
</html>